package com.flx.noodle.websocket.dao.mapper;

import com.flx.noodle.websocket.entity.ChatRoom;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by fenglixiong on 2017/10/2.
 */
public class RoomRowMapper implements RowMapper<ChatRoom> {
    public ChatRoom mapRow(ResultSet resultSet, int i) throws SQLException {
        ChatRoom chatRoom = new ChatRoom();
        chatRoom.setChatId(resultSet.getInt("id"));
        chatRoom.setUserId(resultSet.getInt("user_id"));
        chatRoom.setLastMsg(resultSet.getString("last_msg"));
        chatRoom.setCreateTime(resultSet.getTimestamp("create_time"));
        chatRoom.setLastMsgTime(resultSet.getTimestamp("last_time"));
        return chatRoom;
    }
}
